package com.zhl.scheduling.controller;

import com.zhl.scheduling.model.bo.UsersListQueryBO;
import com.zhl.scheduling.model.entity.Department;
import com.zhl.scheduling.model.entity.User;
import com.zhl.scheduling.model.vo.ResultVO;
import com.zhl.scheduling.service.SystemUsersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: ZhangLu In DLUT
 * @since: 1.0.0
 * @Description:提供系统设置相关的接口
 */
@Api(value = "提供用户的crud相关接口", tags = "用户管理相关")
@RestController
@RequestMapping("/users")
@CrossOrigin
public class SystemUsersController {

    @Resource
    private SystemUsersService systemUsersService;

    @ApiOperation("根据条件获取用户列表")
    @PostMapping("/getList")
    public ResultVO getList(@RequestBody UsersListQueryBO usersListQueryBO){
        return systemUsersService.getList(usersListQueryBO);
    }

    @ApiOperation("添加部门列表信息")
    @PostMapping("/addDepartment")
    public ResultVO addDepartment(@RequestBody Department department){
        return systemUsersService.addDepartment(department);
    }

    @ApiOperation("修改用户相关信息")
    @PostMapping("/updateUser")
    public ResultVO updateUser(@RequestBody User user){
        return systemUsersService.updateUser(user);
    }

    @ApiOperation("增加用户相关信息")
    @PostMapping("/addUser")
    public ResultVO addUser(@RequestBody User user){
        return systemUsersService.addUser(user);
    }
}
